#!/usr/bin/env python
import pygame

class TextRenderer(object):
    def __init__(self):
        pass
    
    def setup(self, window, size = 24, _font = None):
        self.window = window
        self.font = pygame.font.Font( _font, size )
    
    def render( self, txt, pos, colour = (0, 0, 0) ):
        """
        pos is a (x, y) tuple where to display the txt
        txt is the text to render
        
        TODO: handle \n chars and break up too long lines
        """
        self.window.screen.blit( self.font.render( txt, False, colour ), pos )


_renderer = TextRenderer(  )

#----------------------------------------
def instance() : return _renderer

__all__ = [ 'instance' ]